#ifndef E_PLUGIN_H
#define E_PLUGIN_H

#include <DefineLibCommon.h>
#include <DefineCommon.h>

#include <EItem.h>
#include <EString.h>
#include <memory>

/**EPlugin class is the interface that must be overloaded
 * */
class EPlugin;
// typedef SmartPtr(EPlugin) EPluginPtr;
typedef EPlugin* EPluginPtr;
class COMMON_DLL EPlugin
{
public:
    typedef void* HandleDll;
    typedef void* Fun_Address;
    typedef EPluginPtr (*Fun_EPluginExportFunction)();

    EPlugin();
    virtual ~EPlugin();
    virtual EString getName() = 0;
    virtual EString getDescription() = 0;
    
    //called by EPluginLoader
    void setDllHandle(HandleDll dllHandle)
    {
        m_handleDll = dllHandle;
    }
    //called by EPluginLoader
    void setFunEPluginExportFunction(Fun_Address funAddress)
    {
        m_fun = funAddress;
    }
    
    /**called by EPluginLoader, will call EPluginExportFunction
    This function is not suggested to rewrite*/
    virtual void registThis();

    /**Get the Type Item Root, a item represent a type, type name is stored in Item's type value
     * This design will reusing program that convert EItem tree to Widget Tree*/
    // virtual EItemPtr getItem();
protected:
    HandleDll m_handleDll;
    Fun_Address m_fun;
};

#endif // E_PLUGIN_H
